package file1;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Filew {
	public static void main(String[] args) {
		File a=new File("d:\\java.txt");
		File b=new File("d:\\bak.txt");
		try {
			InputStreamReader isr=new InputStreamReader(new FileInputStream(a), "Unicode");
			OutputStreamWriter osr=new OutputStreamWriter(new FileOutputStream(b) , "Unicode");
			int c=isr.read();
			while(c!=-1){
				System.out.print((char)c);
				osr.write(c);
				osr.write("-");
				c=isr.read();
			}
			osr.write("复制完成！");
			osr.flush();osr.close();
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
